package com.wtwd.device.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wtwd.device.model.entity.Device;
import com.wtwd.device.model.entity.DeviceInfoByRangeDto;
import com.wtwd.device.model.entity.SysUser;
import com.wtwd.device.model.vo.CountAreaDeviceVO;
import com.wtwd.device.model.vo.RespEntity;
import com.wtwd.device.model.vo.WatchVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;

/**
 * @author ljiong
 * @date 2021/08/06
 * @description
 */
public interface DeviceInfoService {
    IPage<WatchVo> getWatchListByConditions(HashMap<String, Object> searchMap, Page<Object> page);

    Integer bathDelDeviceByDeviceIdList(List<Integer> deviceIdList);

    Integer deleteDeviceByDeviceId(Integer deviceId);

    RespEntity importDeviceInfo(MultipartFile file, SysUser sysUser, HttpServletResponse response);

    RespEntity batchImportDeviceInfoByRange(DeviceInfoByRangeDto deviceInfoByRangeDto);

    Boolean checkWatchIdList(List<String> watchIdList);

    List<String> getWatchIdByGroupByCustomerId(Long customerId);

    RespEntity activeDevice(String macAddress, String watchId, String currentFirmware, Integer activation);

    Integer countDeviceByCustomerId(Long customerId);

    Integer countActivatedDeviceByCustomerId(Long customerId);

    List<CountAreaDeviceVO> countAreaDeviceByCustomerId(Long customerId);

    RespEntity exportDeviceInfo(String macAddress, Integer activation, String customerName, Long customerId, HttpServletResponse response);

    void unBindDeviceByMac(String mac);

    boolean batchSaveDevice(List<Device> deviceInfos);

    /**
     * 根据条件分页查询设备
     *
     * @param macAddress
     * @param activation   是否激活 0：未激活，1激活
     * @param customerId
     * @param customerIds
     * @param page
     * @return
     */
    IPage<Device> getWatchListByConditionsPage(String macAddress, Integer activation, Long customerId, List<Long> customerIds, Page<Device> page);
}
